﻿<?php
	if( isset($_GET["name"]) && isset($_GET["md5password"]) )
	{
		$name = $_GET["name"];
		$name = urldecode($name);
		$md5password = $_GET["md5password"];

		include ("../DB/Connect.php");
		$query = "select * from userInfo where name = '$name'";
		if( !$db -> getData($query) )
			die($db -> error);
		
		$res = $db -> res;
		
		if( isset( $res[0]["password"] ) )
		{
			if( md5( $res[0]["password"] ) == $md5password )
			{
				if( $res[0]["active"] == true )
				{
					echo "has";
				}
				else
				{
					$query = "update userInfo set active = true where name = '$name'";
					if( !$db -> runSql($query) )
						die($db -> error);
					echo "ok".$name;
				}
			}
			else
			{
				echo "链接错误！";
			}
		}
		else
		{
			echo "无此账号！";
		}
	}
	else
	{
		echo "链接错误！";
	}
?>